package com.example.springboot_zc.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springboot_zc.mapper.classMapper;
import com.example.springboot_zc.pojo.Class;
import com.example.springboot_zc.service.classService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(rollbackFor=Exception.class)
@Service
public class classServiceImpl extends ServiceImpl<classMapper, Class> implements classService {

    @Autowired
    classMapper classMapper;

    @Override
    public void deleteByStu(String stuNum){
        classMapper.deleteByStu(stuNum);
    }


    @Override
    public List<Class> allClass(String status) {
        LambdaQueryWrapper<Class> lqw = new LambdaQueryWrapper<Class>();
        lqw.eq(Class::getStatus, status);
        List<Class> cc = classMapper.selectList(lqw);

        return cc;
    }

    @Override
    public List<Class> getOrder(){
        LambdaQueryWrapper<Class> lqw = new LambdaQueryWrapper<Class>();
//        lqw.likeRight(Class::getContent,s);
//
//        lqw.orderByAsc(Class::getSelfScore);
//        lqw.last("limit 9");
        List<Class> classList = classMapper.selectList(lqw);
        return classList;
    }
}
